<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
</body>
<script>
    var merge = function(nums1, m, nums2, n) {
        let j=0;
        for(let i = m; i<m+n; i++){
            nums1[i]=nums2[j++];
        }
        nums1.sort(function(a,b){
            return a-b;
        })
    };
    let nums1 = [1,2,3,0,0,0], m = 3,nums2 = [2,5,6], n = 3;
    merge(nums1, m, nums2, n);
    console.log(nums1);
    
</script>
</html>